#include "stdafx.h"

#include "GamePlayScreen.h"

namespace ETM
{
	namespace GameScreens
	{
		GamePlayScreen::GamePlayScreen()
		{

		}

		void GamePlayScreen::Initialize()
		{
			view = sf::View(sf::FloatRect(0, 0, 800, 600));

			player = Player();
		}

		void GamePlayScreen::Load()
		{
			player.SetLevel(&level);
			level.SetPlayer(&player);

			level.LoadFromFile("Levels/dungeon.txt");
			player.Load();
		}

		void GamePlayScreen::Update(float delta)
		{
			level.Update(delta);
			player.Update(view, delta);
		}

		void GamePlayScreen::Render(sf::RenderWindow& window)
		{
			//Render Game
			window.SetView(view);

			level.Render(window);
			player.Render(window);

			//Render Interface
			window.SetView(window.GetDefaultView());
		}
	}
}